package com.dkd.manage.controller;

import com.dkd.common.annotation.Anonymous;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.page.TableDataInfo;
import com.dkd.manage.domain.Channel;
import com.dkd.manage.domain.Rank;
import com.dkd.manage.domain.Sales;
import com.dkd.manage.service.IRankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

import static com.dkd.common.utils.PageUtils.startPage;

/**
 * @author QZ09
 * @since 2025-05-14 星期三 10:55:25
 */
@Anonymous
@RestController
@RequestMapping("/manage/rank")
public class RankController extends BaseController {
    @Autowired
    private IRankService rankService;
    @GetMapping("/getRankList")

    public List<Rank> getRankList() {
        try {
            return rankService.getRankList();// 调用服务层方法，避免自我递归
        } catch (Exception e) {
            // 捕获异常并记录日志，防止程序崩溃
            System.err.println("获取销售列表失败: " + e.getMessage());
            e.printStackTrace();
            return new ArrayList<>(); // 返回空列表作为默认值
        }
    }

}
